if (!String.trim) {String.prototype.trim = function() {return this.replace(/^\s+|\s+$/g, "");};}
function validate(theForm) { // passing the form object
  var val = theForm.search.value;
  if (val==null || val.trim()=="") { 
    alert('Please enter some search keywords.');
    theForm.search.focus();
    return false; // cancel submission
  }
  return true; // allow submit
}
